using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Media;

namespace WPFTemplateLib.WpfHelpers
{
	/// <summary>
	/// 滚动视图、滚动条等的帮助类
	/// </summary>
	public static class ScrollHelper
	{
		/// <summary>
		/// 判断元素是否是滚动条中的一部分（来自 DeepSeek）
		/// </summary>
		public static bool IsPartOfScrollBar(DependencyObject element)
		{
			while(element != null)
			{
				if(element is ScrollBar || element is Thumb || element is RepeatButton)
				{
					return true;
				}

				element = VisualTreeHelper.GetParent(element);
			}

			return false;
		}
	}
}
